import React,{Component} from 'react';
import {observer} from 'mobx-react';
import dataStore from './stores/dataStore'

@observer
class Home extends Component {
    constructor(props){
        super(props);
        this.state={
            h2Class:'blue'
        }
    }

    switchColor(){
        this.setState({
            h2Class:'red'
        })
    }
    
    render(){
        console.log('render');
        return(
            <div>
                <h1 style={{background:this.state.h2Class}} onClick={()=>{this.switchColor()}}>in home</h1>
                <h2>{dataStore.homeTitle}</h2>
            </div>
        )
    }
}

export default Home;